<?php


namespace plugin\exportcenter\app\service;


use plugin\exportcenter\app\logic\Export;
use core\traits\SingletonTrait;

class ExportManager
{
    use SingletonTrait;

    protected $actionMap = [];

    public function register($action, Export $class)
    {
        $this->actionMap[$action] = $class;
    }

    /**
     * @param $action
     * @return Export|null
     */
    public function get($action): Export|null
    {
        if (isset($this->actionMap[$action])) {
            return $this->actionMap[$action];
        }
        return null;
    }

    public function dump()
    {
        dump($this->actionMap);
    }

}